1. Field of the Invention
The present invention relates to a mobile terminal, and in particular to a garbage collection system and method for deleting not needed files stored in the active memory of a mobile communication terminal.
2. Description of Related Art
With the development of mobile communication techniques and terminal fabrication techniques, an individual can use a mobile terminal to watch moving pictures, listen to music, connect to the Internet and play mobile games. In order to make a mobile terminal perform the above various functions, a high capacity flash memory is essential. To play moving pictures and music, the terminal needs to have the capacity to store large volumes of data. To maintain a sufficiently free data storage space, not needed or garbage data such as unused programs, read word-messages, and music or image files to which a user will not listen/watch need to be deleted, before new data can be stored. This can be performed by a write/delete function applied to the flash memory areas that contain the unnecessary or unwanted data (hereafter “garbage”).
In a general flash memory, data is stored by recording a byte unit or a word unit. However, data can be deleted only by deleting a designated sector in each storage device. Accordingly, in an EFS (embedded file system), in order to use characteristics of the flash memory, a region is divided/managed into blocks having a certain size, and each block has a header so as to indicate the nature of the recorded contents.
When contents of the block are changed, the block is processed as garbage, a free block is reallocated, and changed contents are recorded again. When garbage generated in deleting or changing of data is increased, the size of a usable free block is reduced. When garbage exceeds a predetermined amount, the terminal deletes the garbage automatically. This is called “garbage collection.”
In a general garbage collection method, there are two approaches, one is performing garbage collection automatically when garbage exceeding a designated reference percentage of one sector is generated, and the other is performing garbage collection forcibly according to a request from a file system when there is data to be stored and there is an insufficient number of free blocks.
Unfortunately, in performing garbage collection for lack of a storage space or when garbage exceeds a reference level, the terminal may reset or the terminal operation speed may be diminished, if system resources are utilized beyond their limits.
In addition, if garbage is unnecessarily collected too frequently, the memory processing speed may be diminished, and the life span of the memory may be adversely affected.